// #include "../src/windows.hpp"
#include "../src/common.h"
#include "../src/image.hpp"
// #include <iostream>
#include <cstdio>
#include <ctime>
#include <cmath>
#include <chrono>

using namespace xege;
int main () {


	WINDOW win (800, 600, 2, SDL_RENDERER_SOFTWARE);
	IMAGE pic (win, 400, 400);
	// IMAGE pic ("./pic/imagetest.png", win);
	pic.drawCircle (200, 200, 100);
	// WINDOW win2 (400, 400);
	int quit = 1, x, y, r = 10;
	SDL_Event event;
	while (quit) {

		switch (SDL_WaitEvent(&event); event.type) {
			case SDL_QUIT://退出事件
				SDL_Log("quit");
				quit = 0;
				SDL_Quit ();
				return 0;
				break;
			case SDL_MOUSEWHEEL:
				if (event.wheel.y > 0) {
					r ++;
				} else if (event.wheel.y < 0) {
					r --;
				}
				break;
			case SDL_WINDOWEVENT_RESIZED: 
				win.clear ();
				break;
			default:
				SDL_Log ("x: %d\ty: %d", x, y);
				// SDL_Log("event type:%d", event.type);
		}
		SDL_GetMouseState (&x, &y);
		// pic.getImage ();
		// pic.getImage ("pic/imagetest.png");
		// win.drawCircle (x, y, r);
		for (double a = 1.0; a <= 10; a+=1.0) {
			win.drawCircle (x, y, r/a);
		}
		// pic.drawBar (150, 150, 250, 250);
		pic.putImage (x - 200, y - 200);
		// win.setfg
		win.update ();
		win.clear ();
		// SDL_SetRenderDrawColor ()
	}


	return 0;
}